<?php
/**
 * @Author: Marte
 * @Date:   2017-08-28 15:08:36
 * @Last Modified by:   Marte
 * @Last Modified time: 2017-08-29 17:19:25
 */
//include('protected/view/home/index/index.html');

    if(!empty($_POST)){
        if($_POST['password']!=$_POST['password1']){
            echo '<script>alert("两次输入的密码不一致");history.go(-1);</script>';die;
        }
        // $email['email']=$_POST['email'];
        // $res=getSelectOne('member',$email);
        // if($res>0){
        //     echo '<script>alert("注册失败邮箱已存在");history.go(-1);</script>';die;
        // }
        unset($_POST['password1']);
        $res=add('member',$_POST);
        if($res>0){
            include_once (LIB_PATH.'send_email.php');
            send_email($_POST['email']);
            echo '<script>alert("注册成功请到邮箱激活");location.href="index.php?c=index&a=index";</script>';die;
        }else{
            echo '<script>alert("注册失败");history.go(-1);</script>';die;
        }
    }


include(VIEW_PATH.$admin.'layout.html');